module EditHelper

  def get_help(topic)
  begin
    help = YAML.load(File.open("#{RAILS_ROOT}/doc/help/" + CUPOLA_CONFIG["help_file"]+".yml"))
  rescue Exception => e
    "<p> "  +  "Sorry, a problem has occured with the help system: " +  e.message  + "</p>"
  end

   if !help.nil? and !help[topic].nil?
      RedCloth.new( help[topic] ).to_html
  else
    "<p>Sorry, no help available for this action</p>"
   end

  end


  def collapsable_panel(contents, title = "Toggle collpased",id="", initial_style="")
    top =  "<div id=\"#{id}\">\
          <span  onClick=\" toggle_fade('#{id}_internal') \" class=\"link_like\">#{title}</span>\
          <div id=\"#{id}_internal\" style=\"#{initial_style}\" > "

    bottom = "</div>\
              </div> "
   
    return top + contents + bottom   
      
  end
end
